#ifndef MUNJIZA_NBS_H
#define MUNJIZA_NBS_H

#include "detColisao.hpp"
#include <vector>
#include <list>
using namespace std;

struct elementoColuna
{
        bool novo;
        vector<SPHERE*> esferas;
};
struct elementoLinha
{

        vector<SPHERE*> esferas;
        bool novo;
};

class Munjiza_nbs : public DetecColisao
{
    private:
            double tamCelula;

            vector< elementoLinha* > linhas;
            vector< elementoColuna* > colunasLinhaAtual;
            vector< elementoColuna* > colunasLinhaPosterior;
            void alocaElementosNaColuna ();
            void alocaElementosNaLinha ();
            void iniciaMatriz( REAL max_rad, REAL min_r[2], REAL max_r[2] );

    public:
        Munjiza_nbs();
        Munjiza_nbs(REAL max_rad, MODEL* pModel,ForcaResultante* t)
        {
            Spheres = &pModel->SPHList;
            iniciaMatriz( max_rad,pModel->BoxMin, pModel->BoxMax );
           // Memory = 0;

            //threadEsfera= new SPHERE*[omp_get_num_procs()];
            Forca = t;
        }

        ~Munjiza_nbs();
        void calcular();

};

#endif // MUNJIZA_NBS_H
